package com.sline.generic;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Demo3_asList {

    public static void main(String[] args) {
        int[] arr = {11, 22, 33, 44, 55};

        List list = Arrays.asList(arr);

        System.out.println(list);

        Integer[] arr1 = {11, 22, 33, 44, 55};

        List list1 = Arrays.asList(arr1);

        System.out.println(list1);

        // 集合专属组
        ArrayList<String> list2 = new ArrayList<>();
        list2.add("a");
        list2.add("b");
        list2.add("c");
        list2.add("d");

        String[] arr2 = list2.toArray(new String[0]);
        String[] arr2_1 = list2.toArray(new String[10]);
        for (int i = 0; i < arr2.length; i++) {
            System.out.println(arr2[i]);
        }
        for (int i = 0; i < arr2_1.length; i++) {
            System.out.println(arr2_1[i]);
        }

    }
}
